//
//  AFN_block.m
//  Coco_Music
//
//  Created by 强哥 on 15/6/21.
//  Copyright (c) 2015年 寇广超. All rights reserved.
//

#import "AFN_block.h"

@implementation AFN_block

+(void)NSString:(NSString *)URLString Blokc:(AFNblock_INFO)Myblock 
{
    
    AFNetworkReachabilityManager *netWorkManager = [AFNetworkReachabilityManager sharedManager];
    
    
    NSString *url_string = [NSString stringWithFormat:@"%@",URLString];
    
    
    //[NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html",nil];  代表支持所有的接口类型
    
    AFHTTPRequestOperationManager* manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html",nil];
    [manager GET:url_string parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        [netWorkManager stopMonitoring];
       // NSLog(@"使用AFN进行get请求 ===  %@",responseObject);
        
        Myblock(responseObject);
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [Network shareSingleton].statu = @"lost_internet";
        NSLog(@"失败==== %@",error);

//        [[NSNotificationCenter defaultCenter] postNotificationName:@"NotConnect" object:nil];
        
    }];
    
}



@end
